package com.emm.yixun.mobile.jpush.service;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;

import com.alibaba.fastjson.JSONObject;
import com.emm.yixun.mobile.application.EmmApplication;
import com.emm.yixun.mobile.base.BaseActivity;
import com.emm.yixun.mobile.ui.NextUpDateActivity;
import com.emm.yixun.mobile.ui.NotSignedActivity;
import com.emm.yixun.mobile.ui.RemindActivity;
import com.emm.yixun.mobile.ui.RemindContentActivity;
import com.emm.yixun.mobile.ui.from.FromDetailsActivity;
import com.emm.yixun.mobile.ui.notice.NoticeFragmentActivity;
import com.emm.yixun.mobile.ui.signed.SigneDetailsdActivity;
import com.emm.yixun.mobile.ui.subscribe.SubscriDetailsActivity;
import com.emm.yixun.mobile.ui.web.WebActivity;
import com.eroad.product.tools.PopuContent;
import com.loopj.android.http.AsyncHttpClient;
import com.loopj.android.http.AsyncHttpResponseHandler;
import com.loopj.android.http.RequestParams;

import org.json.JSONException;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

import cn.jpush.android.api.JPushInterface;
import xf.tointinataface.FlyprintInataface;

/**
 * 自定义接收器
 * <p>
 * 如果不定义这个 Receiver，则： 1) 默认用户会打开主界面 2) 接收不到自定义消息
 */
public class MyReceiver extends BroadcastReceiver {
    private static final String TAG = "JPush";

    @Override
    public void onReceive(Context context, Intent intent) {
        Bundle bundle = intent.getExtras();
        Log.d(TAG, "[MyReceiver] onReceive - " + intent.getAction() + ", extras: " + printBundle(bundle));

        String message = bundle.getString(JPushInterface.EXTRA_ALERT);// 消息内容
        String extra_str = bundle.getString(JPushInterface.EXTRA_EXTRA);// 附加字段

        if (!"1".equals(EmmApplication.getIsLogin())) {
            String str = extra_str;
            JSONObject jsonobject = JSONObject.parseObject(str);
            try {
                String str2 = jsonobject.getString("Data");
                String strType = jsonobject.getString("pushType");
                if (!EmmApplication.isNull(strType)) {
                    Log.v(TAG, "推送消息类型为空 pushType");
                    return;
                }
                // 该条推送的ID
                int notificationId = bundle.getInt(JPushInterface.EXTRA_NOTIFICATION_ID);
                // 点击之后删除该条通知
                JPushInterface.clearNotificationById(context, notificationId);// 删除该条通知(无点击连接事件，不展示)
            } catch (NullPointerException e) {
                e.printStackTrace();
            }
        }

        if (JPushInterface.ACTION_REGISTRATION_ID.equals(intent.getAction())) {
            String regId = bundle.getString(JPushInterface.EXTRA_REGISTRATION_ID);
            Log.d(TAG, "[MyReceiver] 接收Registration Id : " + regId);

        } else if (JPushInterface.ACTION_MESSAGE_RECEIVED.equals(intent.getAction())) {
            Log.d(TAG, "[MyReceiver] 接收到推送下来的自定义消息: " + bundle.getString(JPushInterface.EXTRA_MESSAGE));
            // 此处可以做对消息的逻辑操作
        } else if (JPushInterface.ACTION_NOTIFICATION_RECEIVED.equals(intent.getAction())) {
            Log.d(TAG, "[MyReceiver] 接收到推送下来的通知");
            int notifactionId = bundle.getInt(JPushInterface.EXTRA_NOTIFICATION_ID);
            Log.d(TAG, "[MyReceiver] 接收到推送下来的通知的ID: " + notifactionId);

            if ("1".equals(EmmApplication.getIsLogin())) {
                Log.v(TAG, "已登录，不屏蔽该条推送");
            } else {
                Log.v(TAG, "未登录，屏蔽该条推送");
                // 点击之后删除该条通知
                JPushInterface.clearNotificationById(context, notifactionId);// 删除该条通知(无点击连接事件，不展示)
                return;
            }

            Log.v(TAG, "推送的数据message:" + message);
            Log.v(TAG, "推送的数据jsonObject:" + extra_str);

            // 推送的数据message:亲，您的账号于15:12在一台iOS手机登录。
            // 如非本人操作，则密码可能已泄漏，建议修改密码。
            // 推送的数据jsonObject:{"Data":"{\"name\":\"异地登录\"}","pushType":"yddl"}
            // {"Data":"{"name":"项目变更","merchantId":"10086","content":"当前所在项目发生变更，需要重新拉去数据"}"}

            // FlyprintInataface.finishMain();//关闭首页
            // FlyprintInataface.ReloadProjectList_onl();//刷新首页项目

            if (null != extra_str) {
                String str = extra_str;
                JSONObject jsonobject = JSONObject.parseObject(str);
                try {
                    String str2 = jsonobject.getString("Data");
                    String strType = jsonobject.getString("pushType");
                    if (!EmmApplication.isNull(strType)) {
                        Log.v(TAG, "推送消息类型为空 pushType");
                        return;
                    }
                    if ("yddl".equals(strType)) {
                        // 该条推送的ID
                        int notificationId = bundle.getInt(JPushInterface.EXTRA_NOTIFICATION_ID);
                        // 点击之后删除该条通知
                        JPushInterface.clearNotificationById(context, notificationId);// 删除该条通知(无点击连接事件，不展示)
                        if (null != message) {
                            getremoteLogin(message);
                        }
                    } else if ("xmzbg".equals(strType)) {
                        JSONObject jsonobject2 = JSONObject.parseObject(str2);

                        JPushInterface.clearNotificationById(context, notifactionId);// 删除该条通知
                        String merchantId = jsonobject2.getString("projectId");// 获取到变更的变更的项目ID
                        // 先判断MainActivity是否在栈的最顶层
                        Map<String, String> map = EmmApplication.getTopActivityNameAndProcessName(BaseActivity.activity);
                        Log.v(TAG, "栈顶activity的名字：" + map.get("topActivityName"));
                        Log.v(TAG, "顶层应用的名字" + map.get("processName"));

                        if ("com.example.xf.MainActivity".equals(map.get("topActivityName"))
                                && "com.example.xf".equals(map.get("processName"))) {// 当前应用在栈顶，MainActivity在栈顶
                            // 无论是否改动的当前所在项目，都直接刷新
                            if (merchantId.equals(EmmApplication.getProjectID())) {
                                PopuContent.poPu(BaseActivity.activity, message, false, 66);
                            } else {
                                PopuContent.poPu(BaseActivity.activity, message, false, 44);
                            }
                        } else {// 当前应用或Mainactivity界面不在栈顶,如果是当前项目，则需要弹框提示到首页重新拉去收据，否则添加项目刷新标识，在下次回到Mainactivity的时候刷新
                            if (merchantId.equals(EmmApplication.getProjectID())) {// 如果是当前项目，需要回到首页，并刷新
                                // 弹框提示
                                PopuContent.poPu(BaseActivity.activity, message, false, 55);
                            } else {// 直接设置表示刷新
                                EmmApplication.IsReloadProject = true;// 设置刷新标识
                            }
                        }
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }

        } else if (JPushInterface.ACTION_NOTIFICATION_OPENED.equals(intent.getAction())) {
            Log.d(TAG, "[MyReceiver] 用户点击打开了通知");
            Log.v(TAG, "点开==>推送的数据message:" + message);
            Log.v(TAG, "点开==>推送的数据jsonObject:" + extra_str);

            JSONObject jsonobject_ = JSONObject.parseObject(extra_str);

            String action = jsonobject_.getString("action");

            String pushType = jsonobject_.getString("pushType");

            String projectCode = jsonobject_.getString("projectCode");

            String projectName = jsonobject_.getString("projectName");

            if (null != projectCode) {//不为空就存下此项目ID以及name
                EmmApplication.setProjectCode(projectCode);
                EmmApplication.setData(EmmApplication.ProjectName_content, projectName);
                FlyprintInataface.mLoginClick.ReloadAllmode();//刷新
            }

            // 该条推送的ID
            int notificationId = bundle.getInt(JPushInterface.EXTRA_NOTIFICATION_ID);

            // 点击之后删除该条通知
            JPushInterface.clearNotificationById(context, notificationId);// 删除该条通知(无点击连接事件，不展示)

            // 进行分类跳转
            if (null == pushType || "".equals(pushType) || TextUtils.isEmpty(pushType) || "null".equals(pushType)) {
                Log.v(TAG, "pushType内容为空");
            } else {
                try {
                    JumpToViod(context, bundle, pushType, jsonobject_, message);
                } catch (NullPointerException e) {
                    e.printStackTrace();
                    Log.v(TAG, "存在取参数为空，请debug查看详细情况");
                    try {
                        PopuContent.poPu(BaseActivity.activity, "推送消息内容异常，内容为：" + jsonobject_.toString(), false, 01);
                    } catch (NullPointerException a) {
                        a.printStackTrace();
                    }
                }
            }
        } else if (JPushInterface.ACTION_RICHPUSH_CALLBACK.equals(intent.getAction())) {
            Log.d(TAG, "[MyReceiver] 用户收到到RICH PUSH CALLBACK: " + bundle.getString(JPushInterface.EXTRA_EXTRA));
            // 在这里根据 JPushInterface.EXTRA_EXTRA 的内容处理代码，比如打开新的Activity，
            // 打开一个网页等..
        } else if (JPushInterface.ACTION_CONNECTION_CHANGE.equals(intent.getAction())) {
            boolean connected = intent.getBooleanExtra(JPushInterface.EXTRA_CONNECTION_CHANGE, false);
            Log.w(TAG, "[MyReceiver]" + intent.getAction() + " connected state change to " + connected);
        } else {
            Log.d(TAG, "[MyReceiver] Unhandled intent - " + intent.getAction());
        }
    }

    // 打印所有的 intent extra 数据
    private static String printBundle(Bundle bundle) {
        StringBuilder sb = new StringBuilder();
        for (String key : bundle.keySet()) {
            if (key.equals(JPushInterface.EXTRA_NOTIFICATION_ID)) {
                sb.append("\nkey:" + key + ", value:" + bundle.getInt(key));
            } else if (key.equals(JPushInterface.EXTRA_CONNECTION_CHANGE)) {
                sb.append("\nkey:" + key + ", value:" + bundle.getBoolean(key));
            } else if (key.equals(JPushInterface.EXTRA_EXTRA)) {
                if (bundle.getString(JPushInterface.EXTRA_EXTRA).isEmpty()) {
                    Log.i(TAG, "This message has no Extra data");
                    continue;
                }

                try {
                    org.json.JSONObject json = new org.json.JSONObject(bundle.getString(JPushInterface.EXTRA_EXTRA));
                    Iterator<String> it = json.keys();

                    while (it.hasNext()) {
                        String myKey = it.next().toString();
                        sb.append("\nkey:" + key + ", value: [" + myKey + " - " + json.optString(myKey) + "]");
                    }
                } catch (JSONException e) {
                    Log.e(TAG, "Get message extra JSON error!");
                }

            } else {
                sb.append("\nkey:" + key + ", value:" + bundle.getString(key));
            }
        }
        return sb.toString();
    }

    GetremoteLogin getremotel;

    /**
     * 异地登录
     */
    private void getremoteLogin(final String msg) {
        EmmApplication.updateUrl("remoteLogin");
        Map<String, String> map = new HashMap<String, String>();
        map.put("version", EmmApplication.getPackageManager(5));
        map.put("merchantId", EmmApplication.getData(EmmApplication.merchantId));
        map.put("token", EmmApplication.getToken());
        map.put("userId", EmmApplication.getUserId());
        map.put("terminalCode", EmmApplication.getPackageManager(2));
        map.put("deviceToken", JPushInterface.getRegistrationID(BaseActivity.activity));
        Map<String, Object> paramsMap = new HashMap<String, Object>();
        paramsMap.put("params", map);
        JSONObject json = new JSONObject(paramsMap);
        String jsonstr = json.toString();
        RequestParams params = new RequestParams();
        params.put("body", jsonstr);
        Log.v("remoteLogin-->post", EmmApplication.urlStr + "?body=" + jsonstr);
        AsyncHttpClient asyncHttpClient = new AsyncHttpClient();
        asyncHttpClient.post(EmmApplication.urlStr, params, new AsyncHttpResponseHandler() {
            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                Log.v(TAG, "请求结束error:" + error + "==" + content);
            }

            @Override
            public void onFinish() {
                Log.v(TAG, "请求结束");
                super.onFinish();
            }

            @Override
            public void onStart() {
                super.onStart();
                Log.v(TAG, "请求开始");
            }

            @Override
            public void onSuccess(String content) {
                super.onSuccess(content);
                if (content == null) {
                    return;
                }
                Log.v("content", "content=>" + content);
                JSONObject jsonObj = JSONObject.parseObject(content);
                JSONObject resData = (JSONObject) jsonObj.get("resData");
                if (resData == null) {
                    Log.v(TAG, "信息返回值为空");
                    return;
                }

                getremotel = JSONObject.parseObject(resData.toString(), GetremoteLogin.class);

                if ("1".equals(getremotel.getResult())) {
                    Log.v("获取成功", "");
                    // 0 未登录；1、已登录；2、在其他设备登录；3、 会员登录状态异常；4、已锁定
                    Log.v(TAG, "状态：" + getremotel.getStatus());
                    if ("2".equals(getremotel.getStatus())) {
                        EmmApplication.IsLoadingCustomer = false;
                        EmmApplication.IsLoadingFromList = false;
                        PopuContent.poPu(BaseActivity.activity, msg, false, 77);
                    } else {
                    }
                } else {
                    EmmApplication.T(getremotel.getErrorMsg().toString());
                    Log.v("获取失败", "errorCode:" + getremotel.getErrorCode().toString() + "errorMsg:"
                            + getremotel.getErrorMsg().toString());
                }
            }
        });
    }

    public static class GetremoteLogin {
        private String result;// 返回码
        private String errorCode;// 错误代码
        private String errorMsg;// 错误信息
        private String status;// 登录状态

        public String getResult() {
            return result;
        }

        public void setResult(String result) {
            this.result = result;
        }

        public String getErrorCode() {
            return errorCode;
        }

        public void setErrorCode(String errorCode) {
            this.errorCode = errorCode;
        }

        public String getErrorMsg() {
            return errorMsg;
        }

        public void setErrorMsg(String errorMsg) {
            this.errorMsg = errorMsg;
        }

        public String getStatus() {
            return status;
        }

        public void setStatus(String status) {
            this.status = status;
        }
    }

    /**
     * <p>
     * <b>Title：</b> 跳转方法，根据配置的不同type
     * </p>
     * <p>
     * <b>Description：</b>
     * </p>
     *
     * @author tangxin
     * created at 2017/3/6 13:54
     */
    private void JumpToViod(Context context, Bundle bundle, String pushType, JSONObject jsonobject_, String message) {
        Intent i = null;
        if ("4".equals(jsonobject_.getString("tempType"))) {
            i = WebActivity.Companion.createIntent(context, "backstage_sign", "逾期未签约");
        } else if ("5".equals(jsonobject_.getString("tempType"))) {
            i = WebActivity.Companion.createIntent(context, "backstage_receipt", "逾期未付款");
        } else if ("6".equals(jsonobject_.getString("tempType"))) {
            if ("NT06".equals(pushType)) {
                final String customerId =  jsonobject_.getString("businessId");
                i = WebActivity.Companion.createJump2CustomerDetailIntent(context, customerId);
            } else {
                i = new Intent(context, NotSignedActivity.class);
                i.putExtra("NAME", "待处理客户");
                i.putExtra("TYPED", "3");
            }
        } else if ("7".equals(jsonobject_.getString("tempType"))) {
            i = new Intent(context, NextUpDateActivity.class);
        } else {

            if ("NC".equals(pushType)) {
                // 打开需跳转的Activity(公告)
                i = new Intent(context, NoticeFragmentActivity.class);
                context.sendBroadcast(new Intent(EmmApplication.MAIN_ON_RESUME_TOBE));

            } else if ("NT01".equals(pushType) || "NT22".equals(pushType) || "NT26".equals(pushType) || "NT29".equals(pushType)) {//逾期未签 认购合同详情页 / 审核申请 认购房源 - 认购审核结果

                if ("1".equals(jsonobject_.getString("tempType"))) {//审核申请
                    i = new Intent(context, SubscriDetailsActivity.class);
                    i.putExtra("IsToExamine", "1");//是否从审核  1 是，0否
                    i.putExtra("customerId", jsonobject_.getString("customerId"));//客户ID
                    i.putExtra("subscribeId", jsonobject_.getString("businessId"));//业务ID
                } else if ("2".equals(jsonobject_.getString("tempType"))) {
                    i = startRemindContent(i, context, jsonobject_);
                } else if ("3".equals(jsonobject_.getString("tempType"))) {
                    i = new Intent(context, SubscriDetailsActivity.class);
                    i.putExtra("customerId", jsonobject_.getString("customerId"));//客户ID
                    i.putExtra("subscribeId", jsonobject_.getString("businessId"));//业务ID
                    i.putExtra("IsToExamine", "0");//是否从审核  1 是，0否
                } else {//直接到详情，不需要做审核操作
                    i = new Intent(context, SubscriDetailsActivity.class);
                    i.putExtra("customerId", jsonobject_.getString("customerId"));//客户ID
                    i.putExtra("subscribeId", jsonobject_.getString("businessId"));//业务ID
                    i.putExtra("IsToExamine", "0");//是否从审核  1 是，0否
                }

            } else if ("NT02".equals(pushType) || "NT23".equals(pushType) || "NT27".equals(pushType) || "NT291".equals(pushType)) {//逾期未付款 签约合同的签约详情页 / 审核申请  签约 - 签约审核结果

                if ("1".equals(jsonobject_.getString("tempType"))) {//审核申请
                    i = new Intent(context, SigneDetailsdActivity.class);
                    i.putExtra("customerId", jsonobject_.getString("customerId"));
                    i.putExtra("signId", jsonobject_.getString("businessId"));
                    i.putExtra("IsToExamine", "1");//是否从审核  1 是，0否
                } else if ("2".equals(jsonobject_.getString("tempType"))) {//审核申请
                    i = startRemindContent(i, context, jsonobject_);
                } else if ("3".equals(jsonobject_.getString("tempType"))) {//审核申请
                    i = new Intent(context, SigneDetailsdActivity.class);
                    i.putExtra("customerId", jsonobject_.getString("customerId"));
                    i.putExtra("signId", jsonobject_.getString("businessId"));
                    i.putExtra("IsToExamine", "0");//是否从审核  1 是，0否
                } else {//直接到详情，不需要做审核操作
                    i = new Intent(context, SigneDetailsdActivity.class);
                    i.putExtra("customerId", jsonobject_.getString("customerId"));
                    i.putExtra("signId", jsonobject_.getString("businessId"));
                    i.putExtra("IsToExamine", "0");//是否从审核  1 是，0否
                }

            } else if ("NT03".equals(pushType) || "NT04".equals(pushType) || "NT05".equals(pushType)) {//客户维护  无
                i = new Intent(context, RemindActivity.class);
            } else if ("NT06".equals(pushType)) {//待处理客户  收到的客户的客户详情页
                final String customerId =  jsonobject_.getString("businessId");
                i = WebActivity.Companion.createJump2CustomerDetailIntent(context, customerId);
            } else if ("NT20".equals(pushType) || "NT21".equals(pushType) || "NT24".equals(pushType) || "NT25".equals(pushType)) {//审核申请 无房认筹/有房认筹 - 审核结果  无房认筹审核结果/有房认筹审核结果

                if ("1".equals(jsonobject_.getString("tempType"))) {//审核申请
                    i = new Intent(context, FromDetailsActivity.class);
                    i.putExtra("customerId", jsonobject_.getString("customerId"));
                    i.putExtra("payDepositId", jsonobject_.getString("businessId"));
                    i.putExtra("IsToExamine", "1");//是否从审核  1 是，0否
                } else if ("2".equals(jsonobject_.getString("tempType"))) {//审核申请
                    i = startRemindContent(i, context, jsonobject_);
                } else if ("3".equals(jsonobject_.getString("tempType"))) {//审核申请
                    i = new Intent(context, FromDetailsActivity.class);
                    i.putExtra("customerId", jsonobject_.getString("customerId"));
                    i.putExtra("payDepositId", jsonobject_.getString("businessId"));
                    i.putExtra("IsToExamine", "0");//是否从审核  1 是，0否
                } else {//直接到详情，不需要做审核操作
                    i = new Intent(context, FromDetailsActivity.class);
                    i.putExtra("customerId", jsonobject_.getString("customerId"));
                    i.putExtra("payDepositId", jsonobject_.getString("businessId"));
                    i.putExtra("IsToExamine", "0");//是否从审核  1 是，0否
                }

            } else if ("NT07".equals(pushType) || "NT08".equals(pushType) || "NT09".equals(pushType)) {
                if ("NT07".equals(pushType)) {//审核申请 认筹审批申请
                    i = new Intent(context, FromDetailsActivity.class);
                    i.putExtra("payDepositId", jsonobject_.getString("businessId"));

                } else if ("NT08".equals(pushType)) {//审核申请 认购审批申请
                    i = new Intent(context, SubscriDetailsActivity.class);
                    i.putExtra("subscribeId", jsonobject_.getString("businessId"));

                } else if ("NT09".equals(pushType)) {//审核申请 签约审批申请
                    i = new Intent(context, SigneDetailsdActivity.class);
                    i.putExtra("signId", jsonobject_.getString("businessId"));
                }
                if ("1".equals(jsonobject_.getString("tempType"))) {//审核申请
                    i.putExtra("IsToExamine", "1");//是否从审核  1 是，0否
                } else if ("2".equals(jsonobject_.getString("tempType"))) {//审核申请
                    i = startRemindContent(i, context, jsonobject_);
                } else {//直接到详情，不需要做审核操作
                    i.putExtra("IsToExamine", "0");//是否从审核  1 是，0否
                }
                i.putExtra("customerId", jsonobject_.getString("customerId"));
                i.putExtra("taskId", jsonobject_.getString("taskId"));//任务ID

            } else if ("NT10".equals(pushType) || "NT101".equals(pushType) || "NT13".equals(pushType) || "NT14".equals(pushType) || "NT11".equals(pushType) || "NT111".equals(pushType)
                    || "NT12".equals(pushType) || "NT15".equals(pushType) || "NT151".equals(pushType) || "NT16".equals(pushType) || "NT17".equals(pushType) || "NT171".equals(pushType)
                    || "NT172".equals(pushType) || "NT173".equals(pushType) || "NT18".equals(pushType) || "NT19".equals(pushType) || "NT161".equals(pushType) || "NT162".equals(pushType)
                    || "NT163".equals(pushType)) {
                if ("NT10".equals(pushType)) {
                    i = startRemindContent(i, context, jsonobject_);
                } else if ("NT101".equals(pushType)) {
                    i = startRemindContent(i, context, jsonobject_);
                } else if ("NT11".equals(pushType)) {
                    switch (jsonobject_.getString("tempType")) {
                        case "1":
                            i = startRemindContent(i, context, jsonobject_);
                            break;
                        case "2":
                            i = startRemindContent(i, context, jsonobject_);
                        case "3":
                            i = new Intent(context, SubscriDetailsActivity.class);
                            i.putExtra("subscribeId", jsonobject_.getString("businessId"));
                            break;
                        default:
                            i = startRemindContent(i, context, jsonobject_);
                            break;
                    }
                } else if ("NT111".equals(pushType) || "NT171".equals(pushType) || "NT172".equals(pushType) || "NT173".equals(pushType)
                        || "NT161".equals(pushType) || "NT162".equals(pushType) || "NT163".equals(pushType)) {
                    switch (jsonobject_.getString("tempType")) {
                        case "1":
                            i = startRemindContent(i, context, jsonobject_);
                            break;
                        case "2":
                            i = startRemindContent(i, context, jsonobject_);
                            break;
                        case "3":
                            i = new Intent(context, SigneDetailsdActivity.class);
                            i.putExtra("signId", jsonobject_.getString("businessId"));
                            break;
                        default:
                            i = startRemindContent(i, context, jsonobject_);
                            break;
                    }
                } else if ("NT15".equals(pushType)) {
                    switch (jsonobject_.getString("tempType")) {
                        case "1":
                            i = startRemindContent(i, context, jsonobject_);
                            break;
                        case "2":
                            i = startRemindContent(i, context, jsonobject_);
                            break;
                        case "3":
                            i = new Intent(context, SubscriDetailsActivity.class);
                            i.putExtra("subscribeId", jsonobject_.getString("businessId"));
                            break;
                        default:
                            i = startRemindContent(i, context, jsonobject_);
                            break;
                    }
                } else if ("NT151".equals(pushType)) {
                    switch (jsonobject_.getString("tempType")) {
                        case "1":
                            i = startRemindContent(i, context, jsonobject_);
                            break;
                        case "2":
                            i = startRemindContent(i, context, jsonobject_);
                            break;
                        case "3":
                            i = new Intent(context, SigneDetailsdActivity.class);
                            i.putExtra("signId", jsonobject_.getString("businessId"));
                            break;
                        default:
                            i = startRemindContent(i, context, jsonobject_);
                            break;
                    }
                } else {
                    i = startRemindContent(i, context, jsonobject_);
                }
            } else if ("NT38".equals(pushType) || "NT39".equals(pushType) || "NT40".equals(pushType) || "NT41".equals(pushType) || "NT42".equals(pushType) || "NT43".equals(pushType) || "NT44".equals(pushType) || "NT45".equals(pushType) || "NT33".equals(pushType) || "NT34".equals(pushType) || "NT35".equals(pushType) || "NT36".equals(pushType) || "NT37".equals(pushType)) {//员工关怀 审核结果
                if ("NT33".equals(pushType)) {
                    switch (jsonobject_.getString("tempType")) {
                        case "1":
                            i = startRemindContent(i, context, jsonobject_);
                            break;
                        case "2":
                            i = startRemindContent(i, context, jsonobject_);
                            break;
                        case "3":
                            i = new Intent(context, SubscriDetailsActivity.class);
                            i.putExtra("subscribeId", jsonobject_.getString("businessId"));
                            break;
                        default:
                            i = startRemindContent(i, context, jsonobject_);
                            break;
                    }
                } else if ("NT331".equals(pushType)) {
                    switch (jsonobject_.getString("tempType")) {
                        case "1":
                            i = startRemindContent(i, context, jsonobject_);
                            break;
                        case "2":
                            i = startRemindContent(i, context, jsonobject_);
                            break;
                        case "3":
                            i = new Intent(context, SigneDetailsdActivity.class);
                            i.putExtra("signId", jsonobject_.getString("businessId"));
                            break;
                        default:
                            i = startRemindContent(i, context, jsonobject_);
                            break;
                    }
                } else {
                    i = startRemindContent(i, context, jsonobject_);
                }
            } else if ("NT31".equals(pushType) || "NT32".equals(pushType) || "NT28".equals(pushType) || "NT281".equals(pushType)) {//到详情
                if ("NT28".equals(pushType)) {//认购详情
                    switch (jsonobject_.getString("tempType")) {
                        case "1":
                            i = startRemindContent(i, context, jsonobject_);
                            break;
                        case "2":
                            i = startRemindContent(i, context, jsonobject_);
                            break;
                        case "3":
                            i = new Intent(context, SubscriDetailsActivity.class);
                            i.putExtra("subscribeId", jsonobject_.getString("businessId"));
                            break;
                        default:
                            i = startRemindContent(i, context, jsonobject_);
                            break;
                    }
                } else if ("NT281".equals(pushType)) {//签约详情
                    switch (jsonobject_.getString("tempType")) {
                        case "1":
                            i = startRemindContent(i, context, jsonobject_);
                            break;
                        case "2":
                            i = startRemindContent(i, context, jsonobject_);
                            break;
                        case "3":
                            i = new Intent(context, SigneDetailsdActivity.class);
                            i.putExtra("signId", jsonobject_.getString("businessId"));
                            break;
                        default:
                            i = startRemindContent(i, context, jsonobject_);
                            break;
                    }
                } else {
                    i = startRemindContent(i, context, jsonobject_);
                }
            } else {
                Log.v(TAG, "无此推送类型,请找接口确认：" + pushType);
                return;
            }
        }
        i.putExtras(bundle);
        i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
        context.startActivity(i);
    }

    public Intent startRemindContent(Intent i, Context context, JSONObject jsonobject_) {
        i = new Intent(context, RemindContentActivity.class);
        i.putExtra("TITLE", jsonobject_.getString("remindCategory"));
        i.putExtra("remindCategoryId", jsonobject_.getString("remindCategoryId"));
        return i;
    }

}
